home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / System7 tools / Frontier / Frontier SDK 2.1 / Toolkits / IAC Tools / iacboolean.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-09  |  1.6 KB  |  79 lines  |  [TEXT/KAHL]

  1.   
  2. /*© Copyright 1988-1993 UserLand Software, Inc.  All Rights Reserved.*/
  3.  
  4. #include "iacinternal.h"
  5.  
  6.  
  7.  
  8. Boolean IACpushbooleanparam (Boolean val, OSType keyword) {
  9.  
  10.     return (IACpushbooleanitem (IACglobals.event, val, keyword));
  11.     } /*IACpushbooleanparam*/
  12.  
  13.  
  14. Boolean IACreturnboolean (Boolean fl) {
  15.  
  16.     return (IACpushbooleanitem (IACglobals.reply, fl, keyDirectObject));
  17.     } /*IACreturnboolean*/
  18.  
  19.  
  20. Boolean IACgetbooleanparam (OSType keyword, Boolean *val) {
  21.  
  22.     if (!IACgetbooleanitem (IACglobals.event, keyword, val)) {
  23.         
  24.         IACparamerror (IACglobals.errorcode, "\pboolean", keyword);
  25.         
  26.         return (false);
  27.         }
  28.     
  29.     IACglobals.nextparamoptional = false; /*must be reset for each param*/
  30.     
  31.     return (true);
  32.     } /*IACgetbooleanparam*/
  33.     
  34.     
  35. Boolean IACgetbooleanitem (AEDescList *list, long n, Boolean *val) {
  36.     
  37.     register OSErr ec;
  38.     DescType key;
  39.     DescType typeCode;
  40.     Size actualSize;
  41.     
  42.     if ((*list).descriptorType != typeAEList) {
  43.  
  44.         ec = AEGetKeyPtr (list, n, typeBoolean, &typeCode, (Ptr) val, sizeof (*val), &actualSize);
  45.  
  46.         if (ec != errAEDescNotFound)
  47.             goto done;
  48.         }
  49.  
  50.     ec = AEGetNthPtr (list, n, typeBoolean, &key, &typeCode, (Ptr) val, sizeof (*val), &actualSize);
  51.  
  52.     done:
  53.     
  54.     IACglobals.errorcode = ec;
  55.     
  56.     return (ec == noErr);
  57.     } /*IACgetbooleanitem*/
  58.  
  59.  
  60. Boolean IACpushbooleanitem (AEDescList *list, Boolean val, long n) {
  61.     
  62.     register OSErr ec;
  63.     Boolean    fl;
  64.     
  65.     if (val) /*create a language-independent boolean*/
  66.         val = 1;
  67.     
  68.     if ((*list).descriptorType != typeAEList)
  69.         ec = AEPutKeyPtr (list, n, typeBoolean, (Ptr) &val, sizeof (val));
  70.     else
  71.         ec = AEPutPtr (list, n, typeBoolean, (Ptr) &val, sizeof (val));
  72.     
  73.     IACglobals.errorcode = ec;
  74.     
  75.     return (ec == noErr);
  76.     } /*IACpushbooleanitem*/
  77.  
  78.  
  79.